
import java.io.*;

public class ClassVersionChecker {
    public static void main(String[] args) throws IOException {
    	
    	String[] clases = new String[2];
    	clases[0] = "c:\\es\\unex\\sextante\\gvsig\\extensions\\SextanteAboutExtension.class";
    	clases[1] = "c:\\es\\unex\\sextante\\gvsig\\extensions\\SextanteToolboxExtension.class";
    	
    	
    	System.out.println(clases[0]);
    	
        for (int i = 0; i < clases.length; i++)
            checkClassVersion(clases[i]);
    }

    private static void checkClassVersion(String filename)
        throws IOException
    {
        DataInputStream in = new DataInputStream
         (new FileInputStream(filename));

        int magic = in.readInt();
        if(magic != 0xcafebabe) {
          System.out.println(filename + " is not a valid class!");;
        }
        int minor = in.readUnsignedShort();
        int major = in.readUnsignedShort();
        System.out.println(filename + ": " + major + " . " + minor);
        in.close();
    }
}
